﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using myTutor.Models;

namespace myTutor.Controllers
{
    public partial class SharedController : Controller
    {
        [ValidateInput(false)]
        public ActionResult ConfirmManage(string actionUrl, string cancelUrl, string message)
        {
            var hostUrl = Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
            ViewBag.ActionUrl = hostUrl + VirtualPathUtility.ToAbsolute(actionUrl);
            ViewBag.cancelUrl = hostUrl + VirtualPathUtility.ToAbsolute(cancelUrl);
            ViewBag.Message = message;
            return View();
        }

        //
        // GET: /Shared/

        public ActionResult Error()
        {
            return View();
        }

        [AcceptVerbs(HttpVerbs.Get)]
        public JsonResult GetDistricts(string id)
        {
            return Json(ProvinceMaster.GetSimpleDistricts(id), JsonRequestBehavior.AllowGet);
        }

        [ValidateInput(false)]
        public ActionResult Info(string title, string message, string returnPage, string returnUrl)
        {
            ViewBag.Title = title;
            ViewBag.Message = message;
            ViewBag.ReturnPage = returnPage;
            ViewBag.ReturnUrl = returnUrl;
            return View();
        }
    }
}
